local joy__xiecui = fk.CreateSkill {

  name = "joy__xiecui",

  tags = {  },

}



joy__xiecui:addEffect(fk.DamageCaused, {
  name = "joy__xiecui",
  anim_type = "offensive",
  events = {fk.DamageCaused},
  can_trigger = function(self, event, target, player, data)
    if player:hasSkill(joy__xiecui.name) and target and not target.dead and target == player.room.current and data.card then
      return player:usedSkillTimes(joy__xiecui.name, Player.HistoryTurn) == 0 and
      #player.room.logic:getActualDamageEvents( 1, function(e) return e.data[1].from == target end) == 0
    end
  end,
  on_cost = function(self, event, target, player, data)
    return player.room:askForSkillInvoke(player, joy__xiecui.name, data, "#joy__xiecui-invoke:"..data.from.id..":"..data.to.id)
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    data.damage = data.damage + 1
    if not target.dead and target:getHandcardNum() > target.hp and room:getCardArea(data.card) == Card.Processing then
      room:addPlayerMark(target, MarkEnum.AddMaxCardsInTurn, 1)
      room:moveCardTo(data.card, Card.PlayerHand, target, fk.ReasonPrey, joy__xiecui.name)
    end
  end,
})

return joy__xiecui